import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
import VuexPersistence from 'vuex-persist' //导入持久化插件

//实例化vuex持久化对象
const VuexLocal = new VuexPersistence({
    //制定存储的地方
    storage: window.localStorage,
    //vuex存储的key值
    key: "vuex",
});
export default new Vuex.Store({
    //储存数据
    state: {
      users:{}
    },
    //方法
    mutations: {
        login(state,data){
            console.log('调用vuex中的数据');
            state.users = data;
          }
    },

    actions: {},
    //计算属性
    getters: {

    },
    modules: {},
    plugins: [VuexLocal.plugin],
})